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