예제 #1
0
 public int Edit(int id, DressTypeModel ObjDressTypeModel)
 {
     try
     {
         if (id > 0)
         {
             if (ObjDressTypeModel != null)
             {
                 DressType ObjDressType = DBContext.DressTypes.Where(a => a.DressType_ID == id).FirstOrDefault();
                 if (ObjDressType != null)
                 {
                     //DressTypeModel Edit Properties mapping here.
                     //ObjDressType.Profile_Name = ObjDressTypeModel.Profile_Name;
                     //ObjDressType.Password = ObjDressTypeModel.Password;
                     //ObjDressType.First_Name = ObjDressTypeModel.First_Name;
                     //ObjDressType.Middle_Name = ObjDressTypeModel.Middle_Name;
                     //ObjDressType.Last_Name = ObjDressTypeModel.Last_Name;
                     //ObjDressType.Email_Address = ObjDressTypeModel.Email_Address;
                     //ObjDressType.Contact_Number = ObjDressTypeModel.Contact_Number;
                     //ObjDressType.Cell_Number = ObjDressTypeModel.Cell_Number;
                     //ObjDressType.Location_ID = ObjDressTypeModel.Location_ID;
                     //ObjDressType.PickUp_Address = ObjDressTypeModel.PickUp_Address;
                     //ObjDressType.Drop_Address = ObjDressTypeModel.Drop_Address;
                     //ObjDressType.QR_Code = ObjDressTypeModel.QR_Code;
                     //ObjDressType.Rating = ObjDressTypeModel.Rating;
                     //ObjDressType.Created_DateTime = ObjDressTypeModel.Created_DateTime;
                     //ObjDressType.Created_By = ObjDressTypeModel.Created_By;
                     //ObjDressType.Modified_DateTime = ObjDressTypeModel.Modified_DateTime;
                     //ObjDressType.Modified_By = ObjDressTypeModel.Modified_By;
                     //ObjDressType.Deleted = ObjDressTypeModel.Deleted;
                     DBContext.SubmitChanges();
                     return(ObjDressType.DressType_ID);
                 }
                 else
                 {
                     return(WebApiResponse.NoRecordFound);
                 }
             }
             else
             {
                 return(WebApiResponse.InputObjectIsNull);
             }
         }
         else
         {
             return(WebApiResponse.InputIdInvalid);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #2
0
 public ActionResult Edit(int id, DressTypeModel ObjInputDressTypeModel)
 {
     //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    UpdatedDressTypeId = 0;
         UpdatedDressTypeId = (int)iWebServiceConsumer.ConsumeJsonWebService(ApiURL, ObjInputDressTypeModel, UpdatedDressTypeId, OTS.GlobalSettings.WebAPITimeout, out JsonString);
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         ViewBag.Error = ex.ToString();
         return(View("Error"));
     }
 }
예제 #3
0
 public int Delete(int id, DressTypeModel ObjInputDressTypeModel)
 {
     try
     {
         //Just keep ObjInputDressTypeModel as parameter for Deleted Log.
         DressType ObjDressType = DBContext.DressTypes.Where(a => a.DressType_ID == id).FirstOrDefault();
         if (ObjDressType != null)
         {
             DBContext.DressTypes.DeleteOnSubmit(ObjDressType);
             DBContext.SubmitChanges();
             return(ObjDressType.DressType_ID);
         }
         else
         {
             return(0);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }