Exemple #1
0
        public async Task <ActionResult> UpdateBillingandDueDay(UpdatedBillingandDueDayDto updatedBillingandDueDay)
        {
            ServiceResponce <GetBillingandDueDayDto> serviceResponce = new ServiceResponce <GetBillingandDueDayDto>();

            serviceResponce = await _BillingandDueDayService.UpdateBillingandDueDay(updatedBillingandDueDay);

            if (serviceResponce.Data == null)
            {
                return(NotFound(serviceResponce));
            }
            return(Ok(serviceResponce));
        }
        public async Task <ServiceResponce <GetBillingandDueDayDto> > UpdateBillingandDueDay(UpdatedBillingandDueDayDto updatedBillingandDueDay)
        {
            ServiceResponce <GetBillingandDueDayDto> serviceResponce = new ServiceResponce <GetBillingandDueDayDto>();

            try {
                BillingandDueDay basecurrency = await _dataContext.BillingandDueDays.FirstOrDefaultAsync(c => c.BillingandDueDayId == updatedBillingandDueDay.BillingandDueDayId && c.IsActive == true);

                basecurrency.BillingDay     = updatedBillingandDueDay.BillingDay;
                basecurrency.BillingDueDay  = updatedBillingandDueDay.BillingDueDay;
                basecurrency.LastModifiedBy = updatedBillingandDueDay.LastModifiedBy;
                basecurrency.LastModifiedon = DateTime.Now;
                _dataContext.BillingandDueDays.Update(basecurrency);
                await _dataContext.SaveChangesAsync();

                serviceResponce.Data = _mapper.Map <GetBillingandDueDayDto>(basecurrency);
            }
            catch (Exception e) {
                serviceResponce.Success = false;
                serviceResponce.Message = e.Message;
            }
            return(serviceResponce);
        }