Example #1
0
        public App_Class.ServiceResponse Delete(int PId)
        {
            Core_PackagesCustomizeInquiries result = _ent.Core_PackagesCustomizeInquiries.Where(x => x.InquiryId == PId).FirstOrDefault();

            try
            {
                _ent.DeleteObject(result);
                _ent.SaveChanges();
                _response = new ServiceResponse("Successfully deleted!!", MessageType.Success, true, "Delete");
                return(_response);
            }
            catch (SqlException ex)
            {
                _response = new ServiceResponse(ServiceResponsesProvider.SqlExceptionMessage(ex), MessageType.SqlException, false);
            }
            catch (Exception ex)
            {
                _response = new ServiceResponse(ex.Message, MessageType.Exception, false, "Delete");
            }
            return(_response);
        }
Example #2
0
 public ServiceResponse Save(AirPackageCustomizeInquiryModel model)
 {
     try
     {
         using (var ts = new TransactionScope(TransactionScopeOption.Required))
         {
             Core_PackagesCustomizeInquiries obj = new Core_PackagesCustomizeInquiries
             {
                 AgentId         = model.AgentId,
                 TravelDateStart = model.TravelDateStart,
                 TravelDateEnd   = model.TravelDateEnd,
                 Name            = model.Name,
                 EmailAddress    = model.EmailAddress,
                 NoOfAdult       = model.NoOfAdult,
                 NoOfChild       = model.NoOfChild,
                 ContactNo       = model.ContactNo,
                 Remark          = model.Remark,
                 Status          = model.Status,
             };
             _ent.AddToCore_PackagesCustomizeInquiries(obj);
             _ent.SaveChanges();
             ts.Complete();
             _response = new ServiceResponse("Record successfully created!!", MessageType.Success, true, "Edit");
             return(_response);
         }
     }
     catch (SqlException ex)
     {
         _response = new ServiceResponse(ServiceResponsesProvider.SqlExceptionMessage(ex), MessageType.SqlException, false);
     }
     catch (Exception ex)
     {
         _response = new ServiceResponse(ex.Message, MessageType.Exception, false, "Edit");
     }
     return(_response);
 }