コード例 #1
0
        public IActionResult UpdateLandingPageOption(YachtMerchantViewModel model)
        {
            var resultService = _yachtMerchantService.UpdateLandingPage(model);

            if (resultService.IsSuccessStatusCode)
            {
                return(Ok(resultService));
            }
            return(BadRequest());
        }
コード例 #2
0
 public BaseResponse <bool> UpdateLandingPage(YachtMerchantViewModel model)
 {
     try
     {
         YachtMerchants obj = _context.YachtMerchants.AsNoTracking().FirstOrDefault(x => x.Id == model.Id);
         if (obj != null)
         {
             obj.LandingPageOptionFid = model.LandingPageOptionFid;
             _context.YachtMerchants.Update(obj);
             _context.SaveChanges();
             return(BaseResponse <bool> .Success(true));
         }
         return(BaseResponse <bool> .NotFound(false));
     }
     catch (Exception ex)
     {
         return(BaseResponse <bool> .InternalServerError(message : ex.Message, fullMsg : ex.StackTrace));
     }
 }
コード例 #3
0
        //*****modified by hoangle 10-10-2019
        //*****next modified by
        public BaseResponse <YachtMerchantViewModel> GetYachtMerchantsById(string Id)
        {
            YachtMerchantViewModel merchant = new YachtMerchantViewModel();

            try
            {
                int merChantId = Terminator.Decrypt(Id) != "0" ? Convert.ToInt32(Terminator.Decrypt(Id)) : Int32.Parse(Id);

                merchant = _aqYachtContext.YachtMerchants
                           .Where(k => k.Id == merChantId && k.Deleted == false && k.ExpiredDate >= DateTime.Now.Date)
                           .Select(i => new YachtMerchantViewModel
                {
                    Id                   = i.Id,
                    UniqueId             = i.UniqueId,
                    ZoneFid              = i.ZoneFid,
                    MerchantName         = i.MerchantName,
                    Address1             = i.Address1,
                    Address2             = i.Address2,
                    Country              = i.Country,
                    City                 = i.City,
                    State                = i.State,
                    ZipCode              = i.ZipCode,
                    ContactNumber1       = i.ContactNumber1,
                    ContactNumber2       = i.ContactNumber2,
                    EmailAddress1        = i.EmailAddress1,
                    EmailAddress2        = i.EmailAddress2,
                    AccountSize          = i.AccountSize,
                    Remark               = i.Remark,
                    ExpiredDate          = i.ExpiredDate,
                    LandingPageOptionFid = i.LandingPageOptionFid,
                    //YachtFileStreamId = k.FileStreams.Where(c => c.YachtFid == k.Id && (c.FileTypeFid == 4 || c.FileTypeFid == 5) && c.Deleted == false && c.ActivatedDate <= DateTime.Now).OrderByDescending(d => d.ActivatedDate).FirstOrDefault().FileStreamFid,
                    MerchantFileStreamId = i.FileStreams.Where(c => c.MerchantFid == i.Id && c.Deleted == false && c.ActivatedDate <= DateTime.Now).OrderByDescending(d => d.ActivatedDate).FirstOrDefault().FileStreamFid,
                }).FirstOrDefault();

                return(BaseResponse <YachtMerchantViewModel> .Success(merchant));
            }
            catch (Exception ex)
            {
                return(BaseResponse <YachtMerchantViewModel> .InternalServerError(merchant, message : ex.Message, fullMsg : ex.StackTrace));
            }
        }