Ejemplo n.º 1
0
        public ActionResult CreateVehicleComment(int vehicleId)
        {
            var comment = new VehicleComment()
            {
                VehicleId = vehicleId
            };

            return(PartialView("_CreateOrEditVehicleComment", comment));
        }
Ejemplo n.º 2
0
 public ActionResult EditVehicleComment(VehicleComment vehiclecomment)
 {
     if (ModelState.IsValid)
     {
         _commentRepo.InsertOrUpdateVehicleComments(vehiclecomment);
         _commentRepo.Save();
         return(new HttpStatusCodeResult(HttpStatusCode.OK));
     }
     return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
 }
Ejemplo n.º 3
0
 public void InsertOrUpdateVehicleComments(VehicleComment vehiclecomment)
 {
     if (vehiclecomment.Id == default(int))
     {
         // New entity
         context.VehicleComments.Add(vehiclecomment);
     }
     else
     {
         // Existing entity
         context.Entry(vehiclecomment).State = EntityState.Modified;
     }
 }