示例#1
0
        public async Task <IActionResult> Put(int id, [FromBody] SourcePutRp resource)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.BadRequest(this.ModelState));
            }
            var response = await this._sourceComponent.Update(id, resource);

            return(this.Created(Url.RouteUrl("GetSourceById", new { response.Id }), response));
        }
示例#2
0
        public async Task <SourceGetListRp> Update(int id, SourcePutRp model)
        {
            var createdBy = this._identityGateway.GetIdentity();
            var createdOn = this._datetimeGateway.GetCurrentDateTime();
            var source    = this._dbContext.Sources
                            .Include(c => c.Product).ThenInclude(c => c.Customer)
                            .Where(c => c.Id == id).SingleOrDefault();

            if (source != null)
            {
                return(await this.CreateOrUpdate(source.Product.Customer, source.Product.Name,
                                                 model.Name, model.Tags, model.Avatar, model.AvailabilityDefinition, model.LatencyDefinition, model.ExperienceDefinition,
                                                 model.Description, model.Percentile));
            }
            throw new ApplicationException("Source does not exists");
        }