Esempio n. 1
0
        public string SavePlanTypeMaster(PlanTypeMasterModel plan)
        {
            FlatTypeService     ftservice  = new FlatTypeService();
            FlatTypeSizeService ftsservice = new FlatTypeSizeService();
            var FlatTypemodel = ftservice.GetFlatTypeList();

            if (plan.FType == "0" && plan.FlatTypeSizeID == 0)
            {
                foreach (var flist in FlatTypemodel)
                {
                    var FSizemodel = ftsservice.GetFlatTypeSizeListByFlattypeid(flist.FlatTypeID);
                    foreach (var fsize in FSizemodel)
                    {
                        plan.FlatTypeSizeID = fsize.FlatTypeSizeID;
                        plan.FType          = flist.FType;
                        PlanTypeMasterService ptmService = new PlanTypeMasterService();
                        Mapper.CreateMap <PlanTypeMasterModel, PlanTypeMaster>();
                        var model = Mapper.Map <PlanTypeMasterModel, PlanTypeMaster>(plan);
                        int i     = ptmService.AddPlanTypeMaster(model);
                    }
                }
                return((1).ToString());
            }
            else if (plan.FType == "0" && plan.FlatTypeSizeID != 0)
            {
                foreach (var flist in FlatTypemodel)
                {
                    plan.FType = flist.FType;
                    PlanTypeMasterService ptmService = new PlanTypeMasterService();
                    Mapper.CreateMap <PlanTypeMasterModel, PlanTypeMaster>();
                    var model = Mapper.Map <PlanTypeMasterModel, PlanTypeMaster>(plan);
                    int i     = ptmService.AddPlanTypeMaster(model);
                }
                return((1).ToString());
            }
            else if (plan.FType != "0" && plan.FlatTypeSizeID == 0)
            {
                var ftmodl     = ftservice.GetFlatTypeByFType(plan.FType);
                var FSizemodel = ftsservice.GetFlatTypeSizeListByFlattypeid(ftmodl.FlatTypeID);
                foreach (var fsize in FSizemodel)
                {
                    plan.FlatTypeSizeID = fsize.FlatTypeSizeID;
                    PlanTypeMasterService ptmService = new PlanTypeMasterService();
                    Mapper.CreateMap <PlanTypeMasterModel, PlanTypeMaster>();
                    var model = Mapper.Map <PlanTypeMasterModel, PlanTypeMaster>(plan);
                    int i     = ptmService.AddPlanTypeMaster(model);
                }
                return((1).ToString());
            }
            else
            {
                PlanTypeMasterService ptmService = new PlanTypeMasterService();
                Mapper.CreateMap <PlanTypeMasterModel, PlanTypeMaster>();
                var model = Mapper.Map <PlanTypeMasterModel, PlanTypeMaster>(plan);
                int i     = ptmService.AddPlanTypeMaster(model);
                return(i.ToString());
            }
        }