Ejemplo n.º 1
0
        public async Task <ActionResult> UpdateApp(UpdatedAppDto updatedApp)
        {
            ServiceResponce <GetAppDto> serviceResponce = new ServiceResponce <GetAppDto>();

            serviceResponce = await _AppService.UpdateApp(updatedApp);

            if (serviceResponce.Data == null)
            {
                return(NotFound(serviceResponce));
            }
            return(Ok(serviceResponce));
        }
Ejemplo n.º 2
0
        public async Task <ServiceResponce <GetAppDto> > UpdateApp(UpdatedAppDto updatedApp)
        {
            ServiceResponce <GetAppDto> serviceResponce = new ServiceResponce <GetAppDto>();

            try {
                App app = await _dataContext.Apps.FirstOrDefaultAsync(c => c.AppId == updatedApp.AppId && c.IsActive == true);

                app.AppName        = updatedApp.AppName;
                app.AppCode        = updatedApp.AppCode;
                app.LastModifiedBy = updatedApp.LastModifiedBy;
                app.LastModifiedon = DateTime.Now;
                _dataContext.Apps.Update(app);
                await _dataContext.SaveChangesAsync();

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