示例#1
0
        public RequestResult <CabinSpecificationModel> InsUpd(CabinSpecificationModel model)
        {
            CabinSpecificationDA specificInformationDA   = new CabinSpecificationDA();
            RequestResult <CabinSpecificationModel> resp = new RequestResult <CabinSpecificationModel>()
            {
                Status = Status.Success
            };

            return(specificInformationDA.InsUpd(model));
        }
示例#2
0
        public SpecificInformationModel GetSpecificInfoExtra(int referenceId)
        {
            SpecificInformationServices specificInformationServices = new SpecificInformationServices();
            CabinSpecificationServices  cabinSpecificationServices  = new CabinSpecificationServices();

            SpecificInformationModel       resp      = specificInformationServices.GetByReferenceId(referenceId, SpecificInformationModel.VESSEL_TYPE);
            List <CabinSpecificationModel> lstCabins = cabinSpecificationServices.GetByReferenceId(referenceId, SpecificInformationModel.VESSEL_TYPE);

            CabinSpecificationModel c1 = lstCabins.Where(c => c.CabinType == CabinSpecificationModel.SINGLE_BERTH).FirstOrDefault() ?? new CabinSpecificationModel();
            CabinSpecificationModel c2 = lstCabins.Where(c => c.CabinType == CabinSpecificationModel.DOUBLE_BERTH).FirstOrDefault() ?? new CabinSpecificationModel();
            CabinSpecificationModel c3 = lstCabins.Where(c => c.CabinType == CabinSpecificationModel.FOUR_BERTH).FirstOrDefault() ?? new CabinSpecificationModel();

            resp.SingleBerth = c1.CabinQuantity;
            resp.DoubleBerth = c2.CabinQuantity;
            resp.FourBerth   = c3.CabinQuantity;
            return(resp);
        }
示例#3
0
        public RequestResult <CabinSpecificationModel> InsUpd(CabinSpecificationModel model)
        {
            RequestResult <CabinSpecificationModel> ER = new RequestResult <CabinSpecificationModel>();

            using (var db = new EGULFEntities())
            {
                ObjectParameter Id = new ObjectParameter("CabinSpecificationId", typeof(int?));
                Id.Value = model.CabinSpecificationId;

                ER = db.sp_InsUpdCabinSpecification(Id, model.ReferenceId, model.CabinType, model.CabinQuantity, model.Type)
                     .Select(x => new RequestResult <CabinSpecificationModel>()
                {
                    Status  = (bool)x.IsError ? Status.Error : Status.Success,
                    Message = x.Message
                }).FirstOrDefault();

                if (ER.Status == Status.Success)
                {
                    model.CabinSpecificationId = Convert.ToInt32(Id.Value.ToString());
                }

                return(ER);
            }
        }