Exemplo n.º 1
0
 public ActionResult CreateStore([FromBody] StoreCM model)
 {
     try
     {
         var checkAccount = _accountService.GetAccount(model.AccountId.Value);
         if (checkAccount == null)
         {
             return(NotFound("Not Found"));
         }
         var result = _storeService.GetStores(s => s.Phone == model.Phone);
         if (result.Count() > 0)
         {
             return(BadRequest("Phone has been exsit"));
         }
         Store newStore = model.Adapt <Store>();
         newStore.IsDelete = false;
         newStore.IsActive = true;
         _storeService.CreateStore(newStore);
         _storeService.Save();
         return(Ok(201));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Exemplo n.º 2
0
        public IHttpActionResult GetFinancialPreAnalysis(string projectId, string usCode, string pageType = "")
        {
            var financial  = new FinancialPreanalysis();
            var reimageSum = ReimageSummary.FirstOrDefault(e => e.ProjectId == projectId && e.IsHistory == false);

            if (reimageSum != null)
            {
                financial = FinancialPreanalysis.FirstOrDefault(e => e.RefId == reimageSum.Id);
            }
            if (financial != null)
            {
                if (financial.Id != 0)
                {
                    pageType = "save";
                }
            }
            if (pageType == "")
            {
                //FinancialPreanalysis financial = reimageSummary.LoadFinancialPreanalysisInfo();

                var enti = ReimageConsInfo.FirstOrDefault(e => e.ProjectId.Equals(projectId) && e.IsHistory == true);
                if (enti == null)
                {
                    enti = ReimageConsInfo.FirstOrDefault(e => e.ProjectId.Equals(projectId) && e.IsHistory == false);
                }
                WriteOffAmount writeOff = WriteOffAmount.FirstOrDefault(e => e.ConsInfoID == enti.Id);
                if (financial == null)
                {
                    financial = new FinancialPreanalysis();
                }
                if (writeOff != null)
                {
                    financial.EstimatedWriteOffCost = writeOff.TotalII;
                }
                var ContributionMargin    = StoreCM.Get(usCode).ContributionMargin.ToString();
                var reimageConsInfo       = ReimageConsInfo.GetConsInfo(projectId, "");
                var reinvestmentBasicInfo = ReinvestmentBasicInfo.FirstOrDefault(e => e.ConsInfoID == reimageConsInfo.Id);

                //ReinvestmentCost reinCost = ReinvestmentCost.FirstOrDefault(e => e.ConsInfoID == enti.Id);
                financial.IsMcCafe = reinvestmentBasicInfo.NewMcCafe;

                financial.IsKiosk           = reinvestmentBasicInfo.NewKiosk;
                financial.IsMDS             = reinvestmentBasicInfo.NewMDS;
                financial.IsTwientyFourHour = reinvestmentBasicInfo.NewTwientyFourHour;
                financial.StoreCM           = ContributionMargin;
            }
            return(Ok(financial));
        }