public App_Class.ServiceResponse Delete(int PId) { Core_PackagesInquiries result = _ent.Core_PackagesInquiries.Where(x => x.PackagesInquiryId == 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); }
public ServiceResponse Save(AirPackageInquiryModel model) { try { using (var ts = new TransactionScope(TransactionScopeOption.Required)) { Core_PackagesInquiries obj = new Core_PackagesInquiries { AgentId = model.AgentId, PackageId = model.PackageId, Title = model.Title, TravelDate = model.TravelDate, Name = model.Name, EmailAddress = model.EmailAddress, NoOfAdult = model.NoOfAdult, NoOfChild = model.NoOfChild, ContactNo = model.ContactNo, Remark = model.Remark, CreatedBy = model.CreatedBy, CreatedDate = model.CreatedDate, }; _ent.AddToCore_PackagesInquiries(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); }