コード例 #1
0
 public async Task <ActionResult> UpdateAnswer(AttrAnswerModel attribute)
 {
     try
     {
         return(new JsonResult(await this._repository.UpdateAnswer(attribute)));
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
コード例 #2
0
        public async Task <ResponseStructure> Update(AttrAnswerModel entity)
        {
            try
            {
                var item = await this.GetById(entity.X_Id);

                entity.Created_At = item.Created_At;
                entity.Updated_At = DateTime.Now;
                this._context.Entry(item).State = Microsoft.EntityFrameworkCore.EntityState.Detached;
                this._context.AttributeAnswer.Update(entity);
                await this._context.SaveChangesAsync();

                return(ResponseModel.Success("رکورد مورد نظر با موفقیت بروزرسانی گردید"));
            }
            catch (Exception ex)
            {
                return(null);
            }
        }