public void Save(MasterBin data) { if (data.BinId == 0) { var institutionId = _securityService.GetCurrentInstitutionId(); data.InstitutionId = institutionId; } _binRepository.Save(data); _binRepository.Commit(); }
public IHttpActionResult Delete(MasterBin data) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { _binService.Delete(data); return(Ok()); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public void Save(MasterReaderModule data) { var institutionId = _securityService.GetCurrentInstitutionId(); if (data.ReaderModuleId == 0) { data.InstitutionId = institutionId; } _readerModuleRepository.Save(data); _readerModuleRepository.Commit(); if (data.Bins == null || data.Bins.Count() == 0) { var count = 1; for (var i = 1; i <= data.NoOfStack; i++) { for (var j = 1; j <= data.NoOfRow; j++) { var binCode = data.ReaderModuleCode + count.ToString("00"); var bin = new MasterBin() { BinCode = binCode, EmptyDistance = data.DefaultBinEmptyDistance, ReaderModuleId = data.ReaderModuleId, StackNo = i, RowNo = j, InstitutionId = institutionId }; _binService.Save(bin); count++; } } } else { _binService.Save(data.Bins.ToList()); } }
public void Delete(MasterBin data) { _binRepository.Delete(data); _binRepository.Commit(); }