public int Edit(int id, DressStyleModel ObjDressStyleModel)
 {
     try
     {
         if (id > 0)
         {
             if (ObjDressStyleModel != null)
             {
                 DressStyle ObjDressStyle = DBContext.DressStyles.Where(a => a.DressStyle_ID == id).FirstOrDefault();
                 if (ObjDressStyle != null)
                 {
                     //DressStyleModel Edit Properties mapping here.
                     //ObjDressStyle.Profile_Name = ObjDressStyleModel.Profile_Name;
                     //ObjDressStyle.Password = ObjDressStyleModel.Password;
                     //ObjDressStyle.First_Name = ObjDressStyleModel.First_Name;
                     //ObjDressStyle.Middle_Name = ObjDressStyleModel.Middle_Name;
                     //ObjDressStyle.Last_Name = ObjDressStyleModel.Last_Name;
                     //ObjDressStyle.Email_Address = ObjDressStyleModel.Email_Address;
                     //ObjDressStyle.Contact_Number = ObjDressStyleModel.Contact_Number;
                     //ObjDressStyle.Cell_Number = ObjDressStyleModel.Cell_Number;
                     //ObjDressStyle.Location_ID = ObjDressStyleModel.Location_ID;
                     //ObjDressStyle.PickUp_Address = ObjDressStyleModel.PickUp_Address;
                     //ObjDressStyle.Drop_Address = ObjDressStyleModel.Drop_Address;
                     //ObjDressStyle.QR_Code = ObjDressStyleModel.QR_Code;
                     //ObjDressStyle.Rating = ObjDressStyleModel.Rating;
                     //ObjDressStyle.Created_DateTime = ObjDressStyleModel.Created_DateTime;
                     //ObjDressStyle.Created_By = ObjDressStyleModel.Created_By;
                     //ObjDressStyle.Modified_DateTime = ObjDressStyleModel.Modified_DateTime;
                     //ObjDressStyle.Modified_By = ObjDressStyleModel.Modified_By;
                     //ObjDressStyle.Deleted = ObjDressStyleModel.Deleted;
                     DBContext.SubmitChanges();
                     return(ObjDressStyle.DressStyle_ID);
                 }
                 else
                 {
                     return(WebApiResponse.NoRecordFound);
                 }
             }
             else
             {
                 return(WebApiResponse.InputObjectIsNull);
             }
         }
         else
         {
             return(WebApiResponse.InputIdInvalid);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #2
0
 public ActionResult Edit(int id, DressStyleModel ObjInputDressStyleModel)
 {
     //Customized try catch block by Imran Khan. CodeSnippet
     try
     {
         string JsonString          = string.Empty;
         string ApiURL              = OTS.GlobalSettings.WebAPIURL + this.GetType().Name.Replace("Controller", string.Empty) + "/" + System.Reflection.MethodBase.GetCurrentMethod().Name + "/" + id;
         int    UpdatedDressStyleId = 0;
         UpdatedDressStyleId = (int)iWebServiceConsumer.ConsumeJsonWebService(ApiURL, ObjInputDressStyleModel, UpdatedDressStyleId, OTS.GlobalSettings.WebAPITimeout, out JsonString);
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         ViewBag.Error = ex.ToString();
         return(View("Error"));
     }
 }
 public int Delete(int id, DressStyleModel ObjInputDressStyleModel)
 {
     try
     {
         //Just keep ObjInputDressStyleModel as parameter for Deleted Log.
         DressStyle ObjDressStyle = DBContext.DressStyles.Where(a => a.DressStyle_ID == id).FirstOrDefault();
         if (ObjDressStyle != null)
         {
             DBContext.DressStyles.DeleteOnSubmit(ObjDressStyle);
             DBContext.SubmitChanges();
             return(ObjDressStyle.DressStyle_ID);
         }
         else
         {
             return(0);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }