Exemple #1
0
        public async Task UpdateSdlcSystem(int id, sdlc_system model)
        {
            if (id == 0)
            {
                throw new ArgumentNullException("ID cannot be null");
            }

            var ExistingSys = await GetSdlcSystemById(id);

            if (ExistingSys != null)
            {
                ExistingSys.last_modified_date = DateTime.Now;
                ExistingSys.description        = model.description ?? ExistingSys.description;
                ExistingSys.base_url           = model.base_url ?? ExistingSys.base_url;

                await _unitOfWork.SaveChangesAsync();

                Log.Information("Update for Sdlc System with Id " + id);
            }
            else
            {
                throw new NullReferenceException("Sdlc System not found");
            }

            await _unitOfWork.SaveChangesAsync();
        }
Exemple #2
0
        public async Task <sdlc_system> CreateSdlcSystem(sdlc_system model)
        {
            if (model.base_url == null)
            {
                throw new ArgumentNullException("Base URL cannot be null");
            }

            model.created_date       = DateTime.Now;
            model.last_modified_date = DateTime.Now;

            await _unitOfWork.Sdlc_Systems.AddAsync(model);

            Log.Information("Creation of new Sdlc System " + JsonConvert.SerializeObject(model));

            return(model);
        }