public static Mishap InsertMishap(Mishap mishap) { try { using (var context = new garage_of_carsEntities()) { context.Mishaps.Add(mishap); context.SaveChanges(); return(mishap); } } catch (Exception ex) { throw ex; } }
public static bool InsertMishap(Mishaps mishaps) { var mishapsDAL = new GarageDAL.Mishap() { mishap_description = mishaps.mishap_description, num_of_credits = mishaps.num_of_credits, mishap_urgency = mishaps.mishap_urgency, mishap_status_code = mishaps.mishap_status_code.mishap_status_code }; //Mapper.Initialize(cfg => { // cfg.CreateMap<Workers, Worker>(); // cfg.CreateMap<GarageDAL.Employee_Status, GarageModels.Employee_Status>(); //}); var mishap = MishapDataBase.MishapDal.InsertMishap(mishapsDAL); return(true); }