public ActionResult Details(int id = 0)
 {
     var application = Lib.DAL.Applications.GetDetails(id);
     if (application == null) throw new HttpException(404, "Application not found");
     ViewData["partial"] = new MessageViewModel { tblApplications_applicationId = id };
     ViewBag.countries = new SelectList(Lib.DAL.LanguageCodes.Get(), "languageId", "name");
     return View(application);
 }
 public JsonResult addMessageToApplication(MessageViewModel VMMessage)
 {
     var application = Lib.DAL.Applications.AddMessage(VMMessage);
     if (application == null)
     {
         return Json(new { status = "500", message = "Application not found" });
     }
     return Json(new { status = "200", message = "Succes" });
   
 }
Exemplo n.º 3
0
 public static Application AddMessage(MessageViewModel VMMessage)
 {
     using (var db = new dbContainer())
     {
         var application = db.tblApplications.Find(VMMessage.tblApplications_applicationId);
         tblMessages msg = Mapper.Map<MessageViewModel, tblMessages>(VMMessage);
         application.tblMessages.Add(msg);
         db.SaveChanges();
         return Mapper.Map<tblApplications, Application>(application);
     }
 }