public ContainerCarBrand GetAutoIDFromCarModel(string model) { ContainerCarBrand result = new ContainerCarBrand(); try { using (BIG_VMSEntities ctx = new BIG_VMSEntities()) { var data = ctx.MAS_CAR_MODEL.Where(o => o.NAME == model).FirstOrDefault(); result.ResultObj = data.AUTO_ID; result.Status = true; } } catch (Exception ex) { throw ex; } return(result); }
private void Save() { var obj = new MAS_CAR_BRAND { TYPE_ID = comboCarType.SelectedValue == null ? (int?)null : Convert.ToInt32(comboCarType.SelectedValue), NAME = txtCarBrand.Text.Trim() }; var container = new ContainerCarBrand { MAS_CAR_BRAND = obj }; var res = _service.Create(container); if (res.Status) { MessageBox.Show(Message.MSG_SAVE_COMPLETE); this.DialogResult = DialogResult.OK; this.Close(); } else { MessageBox.Show(res.Message + res.ExceptionMessage); } }