Esempio n. 1
0
 public ActionResult EditPost(Models.PostModel item)
 {
     if (ModelState.IsValid)
     {
         var getByid = postRepository.FindBy(x => x.post == item.post).FirstOrDefault().post;//new PostManager().GetById(item.post).post;
         if (getByid == "" || getByid == null)
         {
             var result = postRepository.Add(new Post {
                 post = item.post
             });                                                            //new PostManager().Create(new Post { post = item.post });
             //ViewBag.Message = result.msg;
         }
         else
         {
             var result = postRepository.Edit(new Post {
                 post = item.post
             });                                                             //new PostManager().Update(new Post { post = item.post });
             ///ViewBag.Message = result.msg;
         }
         return(RedirectToAction("EditPost", "Home"));
     }
     else
     {
         return(View(item));
     }
 }
Esempio n. 2
0
 public ActionResult AddIncident(Models.IncidentsModel item)
 {
     if (ModelState.IsValid)
     {
         var itemIncident = new Incidents();
         itemIncident           = item;
         itemIncident.timestamp = Convert.ToDateTime(DateTime.Now.ToString());
         if (item.idIncident == 0)
         {
             /*var result = new IncidentsManager().Create(itemIncident);
              * ViewBag.Message = result.msg;*/
             repository.Add(item);
             repository.Save();
         }
         else
         {
             //var result = new IncidentsManager().Update(itemIncident);
             //ViewBag.Message = result.msg;
             repository.Edit(itemIncident);
             repository.Save();
         }
         return(RedirectToAction("Index", "Home"));
     }
     else
     {
         return(View(item));
     }
 }
Esempio n. 3
0
 public ActionResult Edit([Bind(Include = "lastMileType")] LastMileType itemlastMileType)
 {
     if (ModelState.IsValid)
     {
         //db.Entry(itemlastMileType).State = EntityState.Modified;
         GM.Edit(itemlastMileType);
         GM.Save();
         return(RedirectToAction("Index"));
     }
     return(View(itemlastMileType));
 }
Esempio n. 4
0
 public ActionResult Edit([Bind(Include = "idIncident,idObject,incidentOpening,IncidentClose,incidentNumberIteko,incidentNumberRT,description")] Incidents incidents)
 {
     if (ModelState.IsValid)
     {
         //db.Entry(incidents).State = EntityState.Modified;
         GM.Edit(incidents);
         GM.Save();
         return(RedirectToAction("Home", "Index"));
     }
     ViewBag.idObject = new SelectList(db.ICC, "idObject", "idpostOffice", incidents.idObject);
     return(View(incidents));
 }
Esempio n. 5
0
 public ActionResult Edit([Bind(Include = "postOffice,postalCode,idpost")] PostOffice itempostOffice)
 {
     if (ModelState.IsValid)
     {
         //db.Entry(itempostOffice).State = EntityState.Modified;
         GM.Edit(itempostOffice);
         GM.Save();
         return(RedirectToAction("Index"));
     }
     ViewBag.idpost = new SelectList(db.Post, "post", "post", itempostOffice.idpost);
     return(View(itempostOffice));
 }
Esempio n. 6
0
 public ActionResult Edit([Bind(Include = "post")] Post postitem)
 {
     if (ModelState.IsValid)
     {
         //db.Entry(post).State = EntityState.Modified;
         //db.SaveChanges();
         if (GM.Edit(postitem))
         {
             if (GM.Save())
             {
                 return(RedirectToAction("Index"));
             }
         }
     }
     return(View(postitem));
 }
Esempio n. 7
0
 // PUT: api/ApiPostOffice/5
 public void Put(int id, [FromBody] PostOffice ind)
 {
     repository.Edit(ind);
 }
Esempio n. 8
0
 // PUT: api/ApiIncidents/5
 public void Put(int id, [FromBody] Incidents ind)
 {
     repository.Edit(ind);
 }
Esempio n. 9
0
 // PUT: api/ApiICC/5
 public void Put(int id, [FromBody] ICC ind)
 {
     repository.Edit(ind);
 }