Example #1
0
        public async Task <PlanningOfficeUpdateResponse> UpdatePlanningOfficeAsync(PlanningOfficeUpdateRequest req)
        {
            var result         = new PlanningOfficeUpdateResponse();
            var validateResult = await ValidateModel(req);

            if (validateResult != null && validateResult.Any())
            {
                result.HasError  = true;
                result.ErrorMsgs = validateResult;
                return(result);
            }
            req.PlanningOffice.UpdatedDate = DateTime.Today;
            return(await _repos.UpdatePlanningOfficeAsync(req));
        }
Example #2
0
        public async Task <PlanningOfficeUpdateResponse> UpdatePlanningOfficeAsync(PlanningOfficeUpdateRequest req)
        {
            using (var conn = new SqlConnection(_connectionSettings.DefaultConnection))
            {
                var          result    = new PlanningOfficeUpdateResponse();
                const string storeproc = @"[dbo].[uspPlanningOfficesUpdate_New]";
                await conn.OpenAsync();

                var dynParm = new
                {
                    req.PlanningOffice.Id,
                    req.PlanningOffice.OfficeName,
                    req.PlanningOffice.UpdatedBy,
                    req.PlanningOffice.UpdatedDate
                };
                var rawResult = await conn.QueryAsync <PlanningOfficeDTO>(storeproc, dynParm, null, null, CommandType.StoredProcedure);

                result.Data = rawResult.FirstOrDefault();
                return(result);
            }
        }