public async Task <BaseResponse <int> > Create(AreaGroupCreate model) { AreaGroup area = new AreaGroup { GroupName = model.GroupName, AreaGroupGuid = Guid.NewGuid() }; await _db.AreaGroups.AddAsync(area); var result = await _db.SaveChangesAsync(); if (result == 1) { return(new BaseResponse <int> { Code = RsponseCode.Success, Message = "تم إضافة الإقليم بنجاح ", Data = 0 }); } return(new BaseResponse <int> { Code = RsponseCode.DataBaseError, Message = "حصل خطأ ", Data = 0 }); }
public async Task <IActionResult> Create([FromBody] AreaGroupCreate model) { var result = await _areaGroupService.Create(model); return(Ok(result)); }