/// <summary> /// Update the exisiting items /// </summary> /// <param name="itemMl"></param> /// <returns></returns> public ActionResult UpdateItem(ItemModel itemMl) { StringBuilder objStringBuilderError = new StringBuilder(); try { if (Session["UserName"] != null) { var duplicateItem = CheckForDuplicate(itemMl); if (duplicateItem > 0) { if (duplicateItem == 1) { Warning(JetstreamResource.DuplicateItemMessage, true); } return RedirectToAction("RedirectToEditItem", new RouteValueDictionary(itemMl)); } else { if (ModelState.IsValid) { itemMl.ExpirationDate = itemMl.ExpirationDate + DateTime.Now.TimeOfDay; using (JetstreamClient objMainServiceClient = new JetstreamClient()) { objMainServiceClient.UpdateItem(itemMl); } Success(JetstreamResource.ItemUpdateMessage, true); return RedirectToAction("ItemDetail", "Item"); } else { return RedirectToAction("RedirectToEditItem", new RouteValueDictionary(itemMl)); } } } else { return RedirectToAction("UserLogin", "Login"); } } catch (FaultException<ServiceData> fex) { objStringBuilderError.AppendLine("In method : UpdateItem(ItemModel itemMl) :: ItemController"); objStringBuilderError.AppendFormat("ErrorMessage::{0} {1}", fex.Detail.ErrorMessage, Environment.NewLine); objStringBuilderError.AppendFormat("ErrorDetails::{0} {1}", Environment.NewLine, fex.Detail.ErrorDetails); SaveLogger.SaveLoggerError(objStringBuilderError.ToString()); return View("Error"); } catch (Exception ex) { objStringBuilderError.AppendLine("In method : UpdateItem(ItemModel itemMl) :: ItemController"); objStringBuilderError.AppendFormat("ErrorMessage::{0} {1}", ex.Message, Environment.NewLine); objStringBuilderError.AppendFormat("ErrorDetails::{0} {1}", Environment.NewLine, ex.ToString()); SaveLogger.SaveLoggerError(objStringBuilderError.ToString()); return View("Error"); } }