using RFrameGenerate.Model;
using RFramework.SQLServer;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RFrameGenerate.BLL
{
    public class CrowdWinManage
    {
        public static Result SaveRa(Guid id, Guid raGuid)
        {
            try
            {
                using (var queryWin = Factory.CreateT_CR_CrowdWinning())
                {
                    var win = queryWin.GetFirstData(a => a.CrowdWinningGuid == id);
                    if (win != null)
                    {
                        queryWin.Update(a => new object[] { a.RecieverAddressGuid == raGuid }, b => b.CrowdWinningGuid == id);
                    }
                    else
                    {
                        return new Result(false, "没有找到中奖记录");
                    }
                }

                return new Result(true);
            }
            catch (Exception ex)
            {
                return new Result(false, ex.Message);
            }
        }
    }
}
