I have 2 questions:

First I wrote a code to add doctors to database, at the beginning the code worked fine but after adding validation the doctor information does not added to table.. when I press add button the URL goes to: **/Doctors/Save**
Why the data does not saved in database? And why after I pressed Add button the program does not redirect me to Add view?

In controller there `Add()` action is for the Add view which contains the adding form.. `Save()` action is for the `Html.BeginForm("Save","Doctors")` that is inside the `Add` view..

Here is my code:

```
public ActionResult Add()
    {  return View();
    }

    [HttpPost]
    [ValidateAntiForgeryToken]
    public ActionResult Save(Doctor doctor)
    {
        if (!ModelState.IsValid)
        {
            var viewModel = new DoctorViewModel
            {
                Doctor = doctor

            };
            return View("Add", viewModel);
        }

      if(doctor.Id == 0) {
      _context.Doctors.Add(doctor);
      _context.SaveChanges();
      return Redirect("Add");
        }
      else
      {
          var doctorInDb = _context.Doctors.Single(c => c.Id == doctor.Id);
          doctorInDb.Name = doctor.Name;
          doctorInDb.Symbol = doctor.Symbol;
          doctorInDb.Office = doctor.Office;
          doctorInDb.Phone = doctor.Phone;
          doctorInDb.Email = doctor.Email;
          _context.SaveChanges();
          return Redirect("Add");
        }

       } 

```

Add view:

```
@model Project.ViewModels.DoctorViewModel

@{
    ViewBag.Title = "Add";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Adding a Doctor</h2>

@using (Html.BeginForm("Save", "Doctors"))
{
    <div class="form-group">

        @Html.LabelFor(m => m.Doctor.Name)
        @Html.TextBoxFor(m => m.Doctor.Name , new { @class = "form-control"})
        @Html.ValidationMessageFor(m => m.Doctor.Name)
    </div>

    <div class="form-group">

        @Html.LabelFor(m => m.Doctor.Symbol)
        @Html.TextBoxFor(m => m.Doctor.Symbol, new { @class = "form-control" })
        @Html.ValidationMessageFor(m => m.Doctor.Symbol)
    </div>
    <div class="form-group">
        @Html.LabelFor(m => m.Doctor.Phone)
        @Html.TextBoxFor(m => m.Doctor.Phone, new { @class = "form-control" })
        @Html.ValidationMessageFor(m => m.Doctor.Phone)
    </div>

    <div class="form-group">
        @Html.LabelFor(m => m.Doctor.Office)
        @Html.TextBoxFor(m => m.Doctor.Office, new { @class = "form-control" })
    </div>

    <div class="form-group">
        @Html.LabelFor(m => m.Doctor.Email)
        @Html.TextBoxFor(m => m.Doctor.Email, new { @class = "form-control" })
    </div>

    @Html.HiddenFor(m => m.Doctor.Id)
    @Html.AntiForgeryToken()
    <button type="submit" class="btn btn-primary"> <h5> Add </h5> </button>     @Html.ActionLink("Go to doctors list", "DoctorList")
}

    @section scripts{
        @Scripts.Render("~/bundles/jqueryval")

        }

```

Second question:

Can I reset the Id, after deleting all records from table, from the controller?

Here is my reset code:

```
public ActionResult Reset()
    {
        _context.PSRs.RemoveRange(_context.PSRs);

        _context.SaveChanges();
        return Redirect("PSR");
    }

```

Thanks!