/// <summary> /// Called from DELETE /// </summary> /// <param name="obj"></param> /// <param name="returnMessage"></param> /// <returns></returns> public bool Delete(string id, out string returnMessage) { returnMessage = string.Empty; using (var edc = new EDC()) { categories obj = Get(id); edc.Entry(obj).State = System.Data.Entity.EntityState.Deleted; try { edc.SaveChanges(); return(true); } catch (Exception ex) { returnMessage = ex.Message; return(false); } } }
/// <summary> /// Called from POST /// </summary> /// <param name="obj"></param> /// <param name="returnMessage"></param> /// <returns></returns> public bool Create(orders obj, out string returnMessage) { Guid id = Guid.NewGuid(); obj.id = id.ToString(); returnMessage = id.ToString(); using (var edc = new EDC()) { edc.Orders.Add(obj); try { edc.SaveChanges(); return(true); } catch (Exception ex) { returnMessage = ex.Message; return(false); } } }