public async Task UpdateLookupSetOptionAsync(LookupSetOptionItemViewModel lookupSet) { _sharedService.WriteLogs("UpdateLookupSetOptionAsync started by:" + _userSettings.UserName, true); try { var _lookupSet = await _lookupSetRepository.GetByIdAsync(lookupSet.Id); Guard.Against.NullLookupSetOption(lookupSet.Id, _lookupSet); _lookupSet.LookupSetId = lookupSet.LookupSetId; _lookupSet.English = lookupSet.English; _lookupSet.French = lookupSet.French; _lookupSet.Value = lookupSet.Value; _lookupSet.Sequence = lookupSet.Sequence; //_lookupSet.YearId = lookupSet.YearId; _lookupSet.ModifiedDate = DateTime.Now; _lookupSet.ModifiedBy = _userSettings.UserName; await _lookupSetRepository.UpdateAsync(_lookupSet); } catch (Exception ex) { _sharedService.WriteLogs("UpdateLookupSetOptionAsync failed:" + ex.Message, false); } }
public async Task CreateLookupSetOptionAsync(LookupSetOptionItemViewModel lookupSet) { _sharedService.WriteLogs("CreateLookupSetOptionAsync started by:" + _userSettings.UserName, true); try { var _lookupSet = new LookupSetOption(); _lookupSet.LookupSetId = lookupSet.LookupSetId; _lookupSet.English = lookupSet.English; _lookupSet.French = lookupSet.French; _lookupSet.Value = lookupSet.Value; _lookupSet.Sequence = lookupSet.Sequence; // _lookupSet.YearId = lookupSet.YearId; _lookupSet.CreatedDate = DateTime.Now; _lookupSet.CreatedBy = _userSettings.UserName; _lookupSet.ModifiedDate = DateTime.Now; _lookupSet.ModifiedBy = _userSettings.UserName; await _lookupSetRepository.AddAsync(_lookupSet); } catch (Exception ex) { _sharedService.WriteLogs("CreateLookupSetOptionAsync failed:" + ex.Message, false); } }
public async Task <LookupSetOptionItemViewModel> GetLookupSetOptionItem(int lookupSetId) { _sharedService.WriteLogs("GetLookupSetOptionItem started by:" + _userSettings.UserName, true); try { var lookupSet = await _lookupSetRepository.GetByIdAsync(lookupSetId); Guard.Against.NullLookupSetOption(lookupSetId, lookupSet); var vm = new LookupSetOptionItemViewModel() { Id = lookupSet.Id, LookupSetId = lookupSet.LookupSetId, English = lookupSet.English, French = lookupSet.French, Value = lookupSet.Value, Sequence = lookupSet.Sequence, //YearId = lookupSet.YearId, CreatedDate = lookupSet.CreatedDate, CreatedBy = lookupSet.CreatedBy, ModifiedDate = lookupSet.ModifiedDate, ModifiedBy = lookupSet.ModifiedBy }; return(vm); } catch (Exception ex) { _sharedService.WriteLogs("GetLookupSetOptionItem failed:" + ex.Message, false); var vm = new LookupSetOptionItemViewModel(); return(vm); } }